package com.kgis.fm.business{

   import flash.events.Event;
   import flash.events.EventDispatcher;

   public class AppContextData extends EventDispatcher {

      public function AppContextData(singletonToken:SingletonToken) {
      }

      private static var _instance:AppContextData = null;
      public static function getInstance():AppContextData {
         if(_instance == null) {
            _instance = new AppContextData(new SingletonToken());
         }
         return _instance;
      }

      private var _currentUserId:Number = NaN;

      public function get currentUserId():Number {
         return _currentUserId;
      }

      public function set currentUserId(value:Number):void {
         _currentUserId = value;
      }

      private var _currentUserName:String = "";

      public function get currentUserName():String {
         return _currentUserName;
      }

      public function set currentUserName(value:String):void {
         _currentUserName = value;
      }

      private var _companyName:String = null;

      [Bindable("companyNameChanged")]
      public function get companyName():String {
         return _companyName;
      }

      public function set companyName(value:String):void {
         if (_companyName == value) {
            return;
         }

         _companyName = value;
         dispatchEvent(new Event("companyNameChanged"));
      }

      private var _sessionTimeout:Number = 0;
      [Bindable("sessionTimeoutChanged")]
      public function get sessionTimeout():Number {
         return _sessionTimeout;
      }

      public function set sessionTimeout(value:Number):void {
         if (_sessionTimeout == value) {
            return;
         }

         _sessionTimeout = value;
         dispatchEvent(new Event("sessionTimeoutChanged"));
      }

      private var _screenLocked:Boolean = false;

      [Bindable("screenLockedChanged")]
      public function get screenLocked():Boolean {
         return _screenLocked;
      }

      public function set screenLocked(value:Boolean):void {
         if (_screenLocked == value) {
            return;
         }

         _screenLocked = value;
         dispatchEvent(new Event("screenLockedChanged"));
      }
      
      private var _systemVersion:String;
      [Bindable]
      public function get systemVersion():String {
         return _systemVersion;
      }
      
      public function set systemVersion(value:String):void {
         _systemVersion = value;
      }

   }
}

class SingletonToken {}